{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "b8d9b7ac-bb1c-4cdd-aa2e-c67838cff5b0",
   "metadata": {},
   "outputs": [],
   "source": [
    "from data.tools.contract_comparison import ContractComparison"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "id": "9d99804f-8c47-408e-aa07-ba9b29de3ec7",
   "metadata": {},
   "outputs": [],
   "source": [
    "instrument_code = \"CNH-onshore\""
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "id": "2d813a5f-52e7-4fa4-8611-474d09afeb64",
   "metadata": {},
   "outputs": [],
   "source": [
    "comparison = ContractComparison()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "id": "8cfa63ad-95da-4a9f-82ed-095bf4378f77",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>FINAL_price</th>\n",
       "      <th>VOLUME_price</th>\n",
       "      <th>FINAL_forward</th>\n",
       "      <th>VOLUME_forward</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>index</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2022-03-14</th>\n",
       "      <td>0.15543</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15543</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-15</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-16</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-17</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-18</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-19</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-20</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-21</th>\n",
       "      <td>0.15572</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15572</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-22</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-23</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-24</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-25</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-26</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-27</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-28</th>\n",
       "      <td>0.15545</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15545</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-29</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-30</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-31</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-01</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-02</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-03</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-04</th>\n",
       "      <td>0.15592</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15592</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-05</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-06</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-07</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-08</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-09</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-10</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-11</th>\n",
       "      <td>0.15576</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15576</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-12</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-13</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-14</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-15</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-16</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-17</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-18</th>\n",
       "      <td>0.15583</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15583</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-19</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-20</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-21</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-22</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-23</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-24</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-25</th>\n",
       "      <td>0.15076</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15076</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-26</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-27</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-28</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-29</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-30</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-05-01</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-05-02</th>\n",
       "      <td>0.14919</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.14919</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            FINAL_price  VOLUME_price  FINAL_forward  VOLUME_forward\n",
       "index                                                               \n",
       "2022-03-14      0.15543           0.0        0.15543             0.0\n",
       "2022-03-15      0.00000           0.0        0.00000             0.0\n",
       "2022-03-16      0.00000           0.0        0.00000             0.0\n",
       "2022-03-17      0.00000           0.0        0.00000             0.0\n",
       "2022-03-18      0.00000           0.0        0.00000             0.0\n",
       "2022-03-19      0.00000           0.0        0.00000             0.0\n",
       "2022-03-20      0.00000           0.0        0.00000             0.0\n",
       "2022-03-21      0.15572           0.0        0.15572             0.0\n",
       "2022-03-22      0.00000           0.0        0.00000             0.0\n",
       "2022-03-23      0.00000           0.0        0.00000             0.0\n",
       "2022-03-24      0.00000           0.0        0.00000             0.0\n",
       "2022-03-25      0.00000           0.0        0.00000             0.0\n",
       "2022-03-26      0.00000           0.0        0.00000             0.0\n",
       "2022-03-27      0.00000           0.0        0.00000             0.0\n",
       "2022-03-28      0.15545           0.0        0.15545             0.0\n",
       "2022-03-29      0.00000           0.0        0.00000             0.0\n",
       "2022-03-30      0.00000           0.0        0.00000             0.0\n",
       "2022-03-31      0.00000           0.0        0.00000             0.0\n",
       "2022-04-01      0.00000           0.0        0.00000             0.0\n",
       "2022-04-02      0.00000           0.0        0.00000             0.0\n",
       "2022-04-03      0.00000           0.0        0.00000             0.0\n",
       "2022-04-04      0.15592           0.0        0.15592             0.0\n",
       "2022-04-05      0.00000           0.0        0.00000             0.0\n",
       "2022-04-06      0.00000           0.0        0.00000             0.0\n",
       "2022-04-07      0.00000           0.0        0.00000             0.0\n",
       "2022-04-08      0.00000           0.0        0.00000             0.0\n",
       "2022-04-09      0.00000           0.0        0.00000             0.0\n",
       "2022-04-10      0.00000           0.0        0.00000             0.0\n",
       "2022-04-11      0.15576           0.0        0.15576             0.0\n",
       "2022-04-12      0.00000           0.0        0.00000             0.0\n",
       "2022-04-13      0.00000           0.0        0.00000             0.0\n",
       "2022-04-14      0.00000           0.0        0.00000             0.0\n",
       "2022-04-15      0.00000           0.0        0.00000             0.0\n",
       "2022-04-16      0.00000           0.0        0.00000             0.0\n",
       "2022-04-17      0.00000           0.0        0.00000             0.0\n",
       "2022-04-18      0.15583           0.0        0.15583             0.0\n",
       "2022-04-19      0.00000           0.0        0.00000             0.0\n",
       "2022-04-20      0.00000           0.0        0.00000             0.0\n",
       "2022-04-21      0.00000           0.0        0.00000             0.0\n",
       "2022-04-22      0.00000           0.0        0.00000             0.0\n",
       "2022-04-23      0.00000           0.0        0.00000             0.0\n",
       "2022-04-24      0.00000           0.0        0.00000             0.0\n",
       "2022-04-25      0.15076           0.0        0.15076             0.0\n",
       "2022-04-26      0.00000           0.0        0.00000             0.0\n",
       "2022-04-27      0.00000           0.0        0.00000             0.0\n",
       "2022-04-28      0.00000           0.0        0.00000             0.0\n",
       "2022-04-29      0.00000           0.0        0.00000             0.0\n",
       "2022-04-30      0.00000           0.0        0.00000             0.0\n",
       "2022-05-01      0.00000           0.0        0.00000             0.0\n",
       "2022-05-02      0.14919           0.0        0.14919             0.0"
      ]
     },
     "execution_count": 38,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "comparison.get_price_volume_comparison(instrument_code=instrument_code,\n",
    "                                         price_date_str='20220300',\n",
    "                                         forward_date_str='20220400',\n",
    "                                         resample_period=\"D\").tail(50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "id": "af506c2c-105e-4abf-9925-db2514ef4e07",
   "metadata": {},
   "outputs": [
    {
     "data": {
      "text/html": [
       "<div>\n",
       "<style scoped>\n",
       "    .dataframe tbody tr th:only-of-type {\n",
       "        vertical-align: middle;\n",
       "    }\n",
       "\n",
       "    .dataframe tbody tr th {\n",
       "        vertical-align: top;\n",
       "    }\n",
       "\n",
       "    .dataframe thead th {\n",
       "        text-align: right;\n",
       "    }\n",
       "</style>\n",
       "<table border=\"1\" class=\"dataframe\">\n",
       "  <thead>\n",
       "    <tr style=\"text-align: right;\">\n",
       "      <th></th>\n",
       "      <th>FINAL_price</th>\n",
       "      <th>VOLUME_price</th>\n",
       "      <th>FINAL_forward</th>\n",
       "      <th>VOLUME_forward</th>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>index</th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "      <th></th>\n",
       "    </tr>\n",
       "  </thead>\n",
       "  <tbody>\n",
       "    <tr>\n",
       "      <th>2021-08-01</th>\n",
       "      <td>0.14994</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.14994</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-08-08</th>\n",
       "      <td>0.15050</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15050</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-08-15</th>\n",
       "      <td>0.15021</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15021</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-08-22</th>\n",
       "      <td>0.15021</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15021</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-08-29</th>\n",
       "      <td>0.15016</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15016</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-09-05</th>\n",
       "      <td>0.15073</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15073</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-09-12</th>\n",
       "      <td>0.15108</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15108</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-09-19</th>\n",
       "      <td>0.15100</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15100</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-09-26</th>\n",
       "      <td>0.15032</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15032</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-10-03</th>\n",
       "      <td>0.15089</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15089</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-10-10</th>\n",
       "      <td>0.15126</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15126</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-10-17</th>\n",
       "      <td>0.15130</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15130</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-10-24</th>\n",
       "      <td>0.15178</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15178</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-10-31</th>\n",
       "      <td>0.15296</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15296</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-11-07</th>\n",
       "      <td>0.15284</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15284</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-11-14</th>\n",
       "      <td>0.15304</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15304</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-11-21</th>\n",
       "      <td>0.15358</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15358</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-11-28</th>\n",
       "      <td>0.15347</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15347</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-05</th>\n",
       "      <td>0.15364</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15364</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-12</th>\n",
       "      <td>0.15380</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15380</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-19</th>\n",
       "      <td>0.15435</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15435</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2021-12-26</th>\n",
       "      <td>0.15387</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15387</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-01-02</th>\n",
       "      <td>0.15430</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15430</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-01-09</th>\n",
       "      <td>0.15472</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15472</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-01-16</th>\n",
       "      <td>0.15463</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15463</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-01-23</th>\n",
       "      <td>0.15545</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15545</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-01-30</th>\n",
       "      <td>0.15624</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15624</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-02-06</th>\n",
       "      <td>0.15498</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15498</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-02-13</th>\n",
       "      <td>0.15544</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15544</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-02-20</th>\n",
       "      <td>0.15550</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15550</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-02-27</th>\n",
       "      <td>0.15614</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15614</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-06</th>\n",
       "      <td>0.15681</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15681</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-13</th>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.00000</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-20</th>\n",
       "      <td>0.15543</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15543</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-03-27</th>\n",
       "      <td>0.15572</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15572</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-03</th>\n",
       "      <td>0.15545</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15545</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-10</th>\n",
       "      <td>0.15592</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15592</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-17</th>\n",
       "      <td>0.15576</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15576</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-04-24</th>\n",
       "      <td>0.15583</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15583</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-05-01</th>\n",
       "      <td>0.15076</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.15076</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "    <tr>\n",
       "      <th>2022-05-08</th>\n",
       "      <td>0.14919</td>\n",
       "      <td>0.0</td>\n",
       "      <td>0.14919</td>\n",
       "      <td>0.0</td>\n",
       "    </tr>\n",
       "  </tbody>\n",
       "</table>\n",
       "</div>"
      ],
      "text/plain": [
       "            FINAL_price  VOLUME_price  FINAL_forward  VOLUME_forward\n",
       "index                                                               \n",
       "2021-08-01      0.14994           0.0        0.14994             0.0\n",
       "2021-08-08      0.15050           0.0        0.15050             0.0\n",
       "2021-08-15      0.15021           0.0        0.15021             0.0\n",
       "2021-08-22      0.15021           0.0        0.15021             0.0\n",
       "2021-08-29      0.15016           0.0        0.15016             0.0\n",
       "2021-09-05      0.15073           0.0        0.15073             0.0\n",
       "2021-09-12      0.15108           0.0        0.15108             0.0\n",
       "2021-09-19      0.15100           0.0        0.15100             0.0\n",
       "2021-09-26      0.15032           0.0        0.15032             0.0\n",
       "2021-10-03      0.15089           0.0        0.15089             0.0\n",
       "2021-10-10      0.15126           0.0        0.15126             0.0\n",
       "2021-10-17      0.15130           0.0        0.15130             0.0\n",
       "2021-10-24      0.15178           0.0        0.15178             0.0\n",
       "2021-10-31      0.15296           0.0        0.15296             0.0\n",
       "2021-11-07      0.15284           0.0        0.15284             0.0\n",
       "2021-11-14      0.15304           0.0        0.15304             0.0\n",
       "2021-11-21      0.15358           0.0        0.15358             0.0\n",
       "2021-11-28      0.15347           0.0        0.15347             0.0\n",
       "2021-12-05      0.15364           0.0        0.15364             0.0\n",
       "2021-12-12      0.15380           0.0        0.15380             0.0\n",
       "2021-12-19      0.15435           0.0        0.15435             0.0\n",
       "2021-12-26      0.15387           0.0        0.15387             0.0\n",
       "2022-01-02      0.15430           0.0        0.15430             0.0\n",
       "2022-01-09      0.15472           0.0        0.15472             0.0\n",
       "2022-01-16      0.15463           0.0        0.15463             0.0\n",
       "2022-01-23      0.15545           0.0        0.15545             0.0\n",
       "2022-01-30      0.15624           0.0        0.15624             0.0\n",
       "2022-02-06      0.15498           0.0        0.15498             0.0\n",
       "2022-02-13      0.15544           0.0        0.15544             0.0\n",
       "2022-02-20      0.15550           0.0        0.15550             0.0\n",
       "2022-02-27      0.15614           0.0        0.15614             0.0\n",
       "2022-03-06      0.15681           0.0        0.15681             0.0\n",
       "2022-03-13      0.00000           0.0        0.00000             0.0\n",
       "2022-03-20      0.15543           0.0        0.15543             0.0\n",
       "2022-03-27      0.15572           0.0        0.15572             0.0\n",
       "2022-04-03      0.15545           0.0        0.15545             0.0\n",
       "2022-04-10      0.15592           0.0        0.15592             0.0\n",
       "2022-04-17      0.15576           0.0        0.15576             0.0\n",
       "2022-04-24      0.15583           0.0        0.15583             0.0\n",
       "2022-05-01      0.15076           0.0        0.15076             0.0\n",
       "2022-05-08      0.14919           0.0        0.14919             0.0"
      ]
     },
     "execution_count": 40,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "comparison.get_price_volume_comparison(instrument_code=instrument_code,\n",
    "                                       price_date_str='20220500',\n",
    "                                       forward_date_str='20220600',\n",
    "                                       resample_period=\"W\").tail(50)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "1f944cd2-f22e-4af9-ad98-5f74f04f3558",
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.8.12"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
